<template>
    <el-cascader
        v-model="cascader"
        :options="options"
        :props="props"
        @change="handleChange"
        ref="cascader"
        :placeholder="placeholder"
        >
    </el-cascader>
</template>

<script>
export default {
    props:{
        options:{
            type:Array,
            default:()=>[],
        },
        value:{
            type:[String,Number],
            default:'',
        },
        props:{
            type:Object,
            default:()=>{
                return {
                    value:'id',
                    label:'title',
                }
            },
        },
        placeholder:{
            type:[String,Function,Object],
            default:'',
        },
        field_id:{
            type:String,
            default:'',
        }
    },
    data(){
        return {
            cascader:[],
        }
    },

    model:{
        prop:'value',
        event:'change'
    },
    methods:{
        handleChange(){
            let item = this.$refs.cascader.getCheckedNodes()[0]
            console.log(item,'9999');
            this.$emit('change',item.value,Object.assign({field_id:this.field_id},item))
        }
    }
}
</script>

<style>

</style>